package com.android.act.setting;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import com.android.R;

public class SettingsActivity extends Activity {
	 
	Button menuBtn;
	List<Map<String, Object>> list = null;
	SimpleAdapter adapter1 = null;
	TextView settingText = null;
	ListView setting_list_item = null;
	Intent intent;
	private TextView topbar_title;
	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_setting); 
		 

		initView();

	}

	private void initView() { 
		topbar_title = (TextView) findViewById(R.id.titlebar_name);
		topbar_title.setText("更多");
		setMap();
		adapter1 = new SimpleAdapter(SettingsActivity.this, list,
				R.layout.setting_list_item, new String[] { "setting_title",
						"setting_img" }, new int[] { R.id.setting_title,
						R.id.setting_img });

		setting_list_item = (ListView) findViewById(R.id.Setting_list_item);
		setting_list_item.setAdapter(adapter1);
		setting_list_item.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1,
					int positon, long arg3) {
				if(positon==0)
				{ 
					startActivity(new Intent(SettingsActivity.this,Feedback.class));
					 
				}
				else if(positon==1)
				{ 
					startActivity(new Intent(SettingsActivity.this,UpdateActivity.class));
				}
				else if(positon==2)
				{ 
					startActivity(new Intent(SettingsActivity.this,SystemInfo.class));
				} 
			}
		});
	}

	public void setMap() {

		list = new ArrayList<Map<String, Object>>();
		Map<String, Object> map = new HashMap<String, Object>();
		map = new HashMap<String, Object>();
		map.put("setting_title", "意见反馈");
		map.put("setting_img", R.drawable.setting_advice);
		list.add(map);
		map = new HashMap<String, Object>();
		map.put("setting_title", "软件更新");
		map.put("setting_img", R.drawable.setting_version_update);
		list.add(map);

		map = new HashMap<String, Object>();
		map.put("setting_title", "系统信息");
		map.put("setting_img", R.drawable.setting_aboutus);
		list.add(map);
	}

}
